﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
    }

    protected void tijiao_Click(object sender, ImageClickEventArgs e)
    {
        YqhData obj = new YqhData();
        string str = string.Format(@"select Count(uname)
                from userinfo
                where uname = '{0}'
	                and uPwd = '{1}'
                    and upower = '1'",
                                txtname.Text,
                                txtpwd.Text);
        int i = Convert.ToInt32(obj.ExecuteScalar(str));
        if(txtcheck.Text.ToLower() == Session["yzm"].ToString().ToLower())
        {
            if (i >= 1)
            {
                Session["login"] = txtname.Text;
                Response.Redirect("adminindex.aspx");
            }
            else
            {
                obj.ShowMsg("登录代码或密码错误,请重新输入！");
            }
        }
        else
        {
            obj.ShowMsg("验证码错误");
        }
    }
}
